package org.ichow.scenegame.controller
{
	import flash.system.fscommand;
	import org.ichow.scenegame.core.ToolsBar;
	import org.ichow.scenegame.model.MusicProxy;
	import org.ichow.scenegame.SceneGameFacade;
	import org.ichow.scenegame.view.HelpMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	/**
	 * ...
	 * @author M.ichow
	 */
	public class ToolsBarCommand extends SimpleCommand
	{

		override public function execute( notification : INotification ) : void
		{
			super.execute( notification );

			switch ( notification.getType() )
			{
				case ToolsBar.SOUND:
					var s : Boolean = notification.getBody() as Boolean;
					var music : MusicProxy = facade.retrieveProxy( MusicProxy.NAME ) as MusicProxy;
					if ( s )
						music.setVolume( 1 );
					else
						music.setVolume( 0 );
					break;
				case ToolsBar.HELP:
					sendNotification( HelpMediator.HELP_SHOW );
					break;
				case ToolsBar.CLOSE:
					sendNotification( SceneGameFacade.EXTERNAL_CALL , { type:"close" , data:"" } , "SceneGameAction" );
					fscommand("quit");
					break;
			}
		}

	}

}